<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">

		<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="css/login.css" />
		<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
		<script src="bootstrap/js/bootstrap.min.js"></script>
	</head>

	<body>
	<div id="_start" style="left: 350px; height: 520px; width: 400px;border: 1px solid rgba(0,0,0,.25);">
			<div id="_close" style="height: 40px; width: 40px;">
				<span class="glyphicon glyphicon-remove"></span>
			</div>
			<br> 
			<!--登录框-->
			<div id="login_container" style="display: block;">
				<div id="lab1">
					<span id="lab_login">会员登录</span>
					<span id="lab_toRegist">
						&emsp;还没有账号&nbsp;
						<span id="toRegist" style="color: #EB9316;cursor: pointer;"  onclick="toRegists(this)">立即注册</span>
					</span>
				</div>
				
				<div id="form_container1">
					<br>
					<input type="text" class="form-control" placeholder="邮箱" id="login_number" >
					<input type="password" class="form-control" placeholder="密码" id="login_password">
					<input type="button" value="登录" onclick="login(this)" class="btn btn-success" id="login_btn">
				</div>

			
			</div>
		</div>
	</body>
	<script type="text/javascript">
		
		
		function login(thisBtn) {
		console.log('login');
		//$("input#test").val();  
		var email=$('#login_number').val();
		var password=$('#login_password').val();
		  $.ajax({
            type: 'GET',
            url: "/api/user/login/"+email+"/"+password,
            data: {
               
            },
            success: function (msg) {
                  console.log('msg',msg);
                if (msg.status == 200) {
                     sessionStorage.setItem("token",msg.data.token);//js使用sessionStorage保存token【单页存储日后需改为浏览器存储】
                  window.location.href="welcome.html"; 
                } 
            },
            dataType: "json"
        });
		}
		
		
		
		
		function toRegists(thisBtn) {
		console.log('login');
		window.location.href="register.html"; 
		}
	</script>

</html>